<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>注册页面</title>
		<style type="text/css">
			
			
			
			#table2 {
				margin: auto;
				margin-top: 20px;
			}
		</style>

	</head>

	<body>
		<form id="form1" name="form1" action="index.html">
			<h2 style="color: cornflowerblue" align="center">请注册</h2>
			<table id="table2" style="background-color: burlywood;" width="350" height="400">
				<tr>
					<th align="right">账号：</th>
					<td><input type="text" name="inTxt" placeholder="请输入用户名" /></td>
				</tr>
				<tr>
					<th align="right">密码：</th>
					<td><input type="password" name="inPwd" placeholder="请输入密码" /></td>
				</tr>
				<tr>
					<th align="right">确认密码：</th>
					<td><input type="password" name="inPwd1" placeholder="再次输入密码" /></td>
				</tr>
				<tr>
					<th align="right">手机号：</th>
					<td><input type="tel" name="tel" placeholder="请输入您的手机号"></td>
				</tr>
				<tr>
					<th align="right">身份证号：</th>
					<td><input type="text" name="creditcard" placeholder="请输入您的身份证号"></td>
				</tr>
				<tr>
					<th>
					</th>
					<th align="left"><input type="button" id="inBtnSub" value="同意注册协议并确认" onclick="sub()" />
					<a href="index3.html"><font size="1">注册协议</font></a></th>
				</tr>
			</table>
		</form>
		<script>
			function sub() {
				var user = document.getElementsByName("inTxt")[0].value;
				var user1 = document.getElementsByName("creditcard")[0].value;
				var tel =document.getElementsByName("tel")[0].value;
				if(user.length == 0 || user.length > 20) {
					alert("请输入正确的账号");
					return;
				} else if(document.getElementsByName("inPwd")[0].value != document.getElementsByName("inPwd1")[0].value) {
					alert("两次输入的密码不同");
					return;
				} else if(user1.length != 18) {
					alert("请输入正确的身份证号");
					return;
				}else if(tel.lenth!=11){
					alert("请输入正确的手机号");
					return;
				}
				document.getElementById("form1").submit();
			}
			//			function ss(){
			//				var user1 = document.getElementsByName("inTxt")[0].value;
			//				console.log(user1)
			//			}
		</script>
	</body>

</html>